/**
 * @param {number[]} nums
 * @return {number}
 */
// 大于等于顺序前缀和的最小缺失整数
var missingInteger = function(nums) {
    let longSum = nums[0]
    for(let i = 1; i < nums.length; i++) {
        if(nums[i] == nums[i - 1] + 1) {
            longSum += nums[i]
        } else {
            break
        }
    }
    // 这里不用排序，转为集合即可
   nums.sort((a ,b) => a- b)
    for(let i = 0; i < nums.length; i++) {
        if(nums[i] === longSum) longSum++
    }
    return longSum
};
// console.log(missingInteger([1,2,3,2,5]));
// console.log(missingInteger([3,4,5,1,12,14,13]));
// console.log(missingInteger([29,30,31,32,33,34,35,36,37]));
// console.log(missingInteger([37,1,2,9,5,8,5,2,9,4]));
console.log(missingInteger([9,12,17,25,5,25,46,10,35,44,21,34,35,44,44]));
